#include "prec.h"

#include "pathhelper.h"
#include "wx/stdpaths.h"
#include "wx/filename.h"
#include "wx/file.h"

wxString PathHelper::GetWorkPath()
{
	wxString apppath;
	wxStandardPathsBase& stpd = wxStandardPaths::Get();

	wxFileName exeFile(stpd.GetExecutablePath());  
	apppath = exeFile.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);

	return apppath;
}

wxString PathHelper::GetArtPath()
{
	return GetWorkPath() + wxT("art\\");
}

wxString PathHelper::GetImageFile( const wxString& filename )
{
	wxString pn = GetArtPath() + filename;
	if (wxFile::Exists(pn))
		return pn;
	else
		return wxEmptyString;
}

wxString PathHelper::GetScriptPath()
{
	return GetWorkPath() + wxT("script\\");
}

wxString PathHelper::GetScriptFile( const wxString& filename )
{
	wxString pn = GetScriptPath() + filename;
	if (wxFile::Exists(pn))
		return pn;
	else
		return wxEmptyString;
}

wxString PathHelper::GetPath( const wxString& dir )
{
	return GetWorkPath() + dir + wxT("\\");
}

wxString PathHelper::GetFile( const wxString& dir, const wxString& filename )
{
	return GetPath(dir) + filename;
}